Item
An object of class Item is any item in a container.PROPERTIES
bounds
- The coordinates of the rectangle that bounds the content region of the item's icon.
Class: List of four integers (Bounding Rectangle data type).
The first two integers specify the coordinates of the upperleft corner of the item's icon, and the last two integers specify the coordinates of the lower-right corner of the icon.
Modifiable? Yes
comment
- The comment displayed in the item's information window.
Class: String
Modifiable: Yescontainer
- A reference to the container in which the item is located.
Class: Reference
Modifiable: Nocontent space
- A reference to the content space that opens when the item
is opened.
Class: Content Space
Modifiable: Nocreation date
- The date on which the item was created.
Class: Date
Modifiable: Nodisk
- A reference to the disk on which the item is stored.
Class: Reference
Modifiable: Nofolder
- A reference to the folder, if any, in which the item is stored.
Class: Reference
Modifiable: Noicon
- A bitmap of the item's icon.
Class: Icon family (data type defined by Finder)
Modifiable: Yesid
- The item's hierarchical file system (HFS) ID number, an integer that identifies an application file, folder, or disk. (For examples of the use of this property, see page 35.)
Class: Integer
Modifiable: Noinformation window
- A reference to the item's information window.
Class: Reference
Modifiable: Nokind
- The kind of item as listed under Kind in the item's
container window.
Class: String
Modifiable: Nolabel index
- The number of the label currently selected for the item in the Label menu (None = 0).
Class: Integer
Modifiable: Yesmodification date
- The date on which the item was most recently modified.
Class: Date
Modifiable: Noname
- The item's name.
Class: String
Modifiable: Yesphysical size
- The physical size of the item on disk, in bytes.
Class: Integer
Modifiable: Noposition
- Two integers that specify the position of the upper-left corner of the item's icon.
Class: List of two integers (Point data type)
Modifiable? Yesselected
- A Boolean value that indicates whether the item is selected (
true
) or not (false
).
Class: Boolean
Modifiable: Yessize
- The logical size of the item on disk, in bytes.
Class: Integer
Modifiable: Nowindow
- A reference to the window that opens when the item is opened.
Class: Reference
Modifiable: NoELEMENT CLASSES
NoneCOMMANDS HANDLED
Clean Up, Close, Copy, Count, Data Size, Delete, Duplicate, Exists, Get, Move, Open, Put Away, Reveal, Select, Sort, UpdateDEFAULT VALUE CLASS RETURNED
A reference to a file, folder, disk, the Trash, or the desktop or, if you use the plural formitems
, a list of references.EXAMPLES
The script that follows moves a group of items that start with an at (@) symbol back and forth between the Apple Menu Items folder and a folder at the top level of the startup disk called Apple Menu Extras.To work correctly, this script must be stored as a script application at the top level of the startup disk; the startup disk must also contain a folder called Apple Menu Extras to store the items you want to move in and out of the Apple Menu Items folder; and the names of the items in the Apple Menu Items folder must all begin with an @ symbol. It is also important, as with any script, to have some free memory available in addition to the memory used by any currently running processes--preferably several hundred kilobytes.
property Extras : false tell application "Finder" if (exists item " Add Extras" of apple menu items folder) ¬ = false and ¬ (exists item " Remove Extras" of apple menu items folder) ¬ = false then make alias file with data (file "Toggle Apple Menu Extras" of ¬ startup disk) at apple menu items folder ¬ with properties {name:" Add Extras"} end if if Extras is false then move contents of folder "Apple Menu Extras" of startup disk to ¬ apple menu items folder set the name of item " Add Extras" in apple menu items folder ¬ to " Remove Extras" set Extras to true else move (every item of apple menu items folder ¬ whose name begins with "@") to ¬ folder "Apple Menu Extras" of startup disk set the name of item " Remove Extras" in ¬ apple menu items folder to " Add Extras" set Extras to false end if end tellThe script begins by declaring the value of theExtras
property to befalse
. This value may change after the script is run.If the script hasn't been run before, the first If statement in the script creates an alias file of the script application in the Apple Menu Items folder with the name Add Extras. This alias file appears in the Apple menu along with all the other items in the Apple Menu Items folder, and its name changes to Remove Extras after the extra items have been added to that folder.
If the value of
Extras
isfalse
, the first part of the second If statement moves the contents of the Apple Menu Extras folder into the Apple Menu Items folder, changes the name of the alias file to Remove Extras, and sets the value ofExtras
totrue
.If the value of
Extras
istrue
, the second part of the second If statement moves all items in the Apple Menu Items folder that begin with an @ symbol into the Apple Menu Extras folder, changes the name of the alias file to Add Extras, and sets the value ofExtras
tofalse
.